load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

cc_binary(
    name = "libtraffic_light_adapter.so",
    linkshared = True,
    linkstatic = False,
    deps = [":traffic_light_adapter_lib"],
)

cc_library(
    name = "traffic_light_adapter_lib",
    srcs = ["traffic_light_adapter_component.cc"],
    hdrs = ["traffic_light_adapter_component.h"],
    linkopts = [
        "-pthread -lz -lrt -luuid"
    ],
    deps = [
        "@com_github_google_glog//:glog",
        "@fastrtps//:fastrtps",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "//middleware/device_service/proto:traffic_light_service_cc_pb",
        "//middleware/protocol/proto:v2xpb-asn-message-frame_cc_pb",
        "//base/device_connect/proto:cloud_data_cc_pb",
        "//middleware/protocol/common:global_conf",
    ],
    copts = [
        "-DUSE_CYBERRT",
	      "-DMODULE_NAME=\\\"traffic_light_adapter\\\""
    ],
)

cc_test(
     name="traffic_light_adapter_ut",
     srcs = [
        "ut/traffic_light_adapter_component_test.cc",
        "traffic_light_adapter_component.h",
     ],
    linkopts = [
        "-pthread -lz"
    ],
    deps=[
      "@com_google_googletest//:gtest_main",
      ":traffic_light_adapter_lib",
    ],
    copts = [
        "-DUSE_CYBERRT"
    ],
    linkstatic = False,
)
